Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capacitor: Android: LeapChat login and WS connection work!!! 🎉 #326

Open
wants to merge 21 commits into
base: capacitorjs
Choose a base branch
from

Conversation

elimisteve
Copy link
Member

leapchat-android-capacitor-ITWORKS-Screenshot_2023-03-02_01-20-46

The emoji image is broken but WHO CARES!!! All these work now:

  • Talk to Go backend from Capacitor at all
  • Get auth token from /api/login (and turn into Blob to pass to miniLock) => Successful login!
  • Establish WS connection with Go backend

@elimisteve elimisteve requested a review from jimmcgaw March 2, 2023 09:28
if (Capacitor.isNativePlatform()){
authUrl = "http://192.168.1.247:8080/api/login";
if (Capacitor.isNativePlatform()) {
authUrl = "http://10.0.2.2:8080/api/login";
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably create global constants like NATIVE_BASE_URL or whatever, but I've hardcoded this for now.

import { Capacitor } from '@capacitor/core';

let wsUrl = `${window.location.origin.replace('http', 'ws')}/api/ws/messages/all`;
if (Capacitor.isNativePlatform()) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did what was quickest to get something working, but we should probably do this conditional once, in one place, and define what are effectively global constants which we then export, then import in places like this.

But... IT WORKS!!!

...for easing testing now and to add to conditional logic soon ™️
@elimisteve
Copy link
Member Author

Closing this because @jimmcgaw already merged these commits into capacitorjs

@elimisteve elimisteve closed this Mar 2, 2023
@elimisteve elimisteve reopened this Mar 5, 2023
elimisteve and others added 16 commits March 4, 2023 18:03
I used document.location.hash to store the passphrase of the current room, even in Capacitor

And I used localStorage["roomList"] to store the list of LeapChat rooms the user has visited

TODO: Make it so clicking on another room you already visited takes you to that room
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants